package testcase;

import common.*;
import java.util.*;

public class JsonParserTest
{
    public static void main(String[] args)
    {
	JsonScaner	js = new JsonScaner();
	JsonParser	jp = new JsonParser();
	Filer		fl = new Filer();

	js.scan(fl.getReader(args[0]));
	
	try
	    {
		for(String item: js)
		    {
			jp.word(js.getState(), item);
		    } 
		System.out.println("No errors");
	    }
	catch(NoSuchElementException nsee)
	    {
		System.out.println("No errors");
	    }
	catch(JsonParserException jpe)
	    {
		System.out.printf("%s:%d\n", fl.fname, fl.NR);
		jpe.printStackTrace();
	    }
	catch(JsonScanerException jse)
	    {
		System.out.printf("%s:%d\n", fl.fname, fl.NR);
		jse.printStackTrace();
	    }
    }
}
